import { API } from '@/services/model/baseModel';
import { CategoryDetailModel, CategoryModel } from '@/services/model/categoryModel';
import config from '@/utils/config';
import { request } from '@/utils/http';

/**
 * 一级分类
 * @returns 分类数据
 */
const getCategoryList = () => {
  return request.get<API<Array<CategoryModel>>>(config.url.category_list);
};

/**
 * 二级分类
 * @returns 分类数据
 */
const getCategoryDetail = (id: number | undefined) => {
  return request.post<API<CategoryDetailModel>>(config.url.category_detail, { id: id });
};

export { getCategoryList, getCategoryDetail };
